import { useRouter } from 'vue-router'

export const appInit = () => {
  const router = useRouter()
  window?.app?.onMessage?.('route:push', (path) => {
    router.push({ path })
  })
}

// 重启应用
export const restartApp = () => {
  window.app.restart()
}

// 设置菜单
export const settingMenuList = [
  {
    label: '检查更新',
    icon: '',
    click: () => {
      window.$router.push({ path: '/update' })
    }
  },
  {
    label: '重启服务',
    icon: '',
    click: restartApp
  },
  {
    label: '退出',
    icon: '',
    click: window.app.quit
  }
]
